Guard corner_cornerpy against samples < dims#1224
Merged
Conversation
The corner-plot helper asserted inside the corner library when called with fewer samples than model dimensions (triggered routinely by PYAUTO_TEST_MODE=2 bypassing the sampler, and possible in any very-early update). Skip and log instead of crashing so downstream scripts can call the plot unconditionally. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
aplt.corner_cornerpyasserted inside thecornerlibrary when called with fewer samples than model dimensions. This is routine underPYAUTO_TEST_MODE=2(bypass leaves 1–2 samples) and can also happen during very-early updates whencorner_cornerpyis called before the sampler has produced a full chain. Log and skip instead of asserting so callers can invoke the plot unconditionally.API Changes
None — internal behaviour of
corner_cornerpynow gracefully skips when samples are insufficient. Callers see an INFO log line and aNonereturn instead of anAssertionError.See full details below.
Test Plan
pytest test_autofit/non_linear/(239 passed)Full API Changes (for automation & release notes)
Changed Behaviour
autofit.non_linear.plot.samples_plotters.corner_cornerpy— now returns early with an INFO log whensamples.parameter_listshasndim < 2or fewer rows than columns (samples < dims+1). Previous behaviour raisedAssertionErrorfromcorner.corner_impl.Co-Authored-By: Claude Opus 4.7 noreply@anthropic.com